package com.kb.spring.jpa.dao;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.RepositoryDefinition;
import org.springframework.data.repository.query.Param;

import com.kb.spring.jpa.entities.Person;

//@RepositoryDefinition(domainClass = Person.class,idClass = Integer.class)
public interface PersonRepository extends Repository<Person,Integer>{
	//根据lastName获取对应的person
	Person getByLastName(String lastName);
	
	//修改操作
	@Modifying
	@Query("update Person p set p.age = :age ,p.lastName = :lastName where p.id = :id")
	void updatePerson(@Param("age")Integer age,@Param("lastName")String lastName,@Param("id")Integer id);
}
